package cj.web.portal.dao;

import java.util.List;
import java.util.Map;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;

@DAO
public interface UCDAO {
	
	//发行网点
	@SQL("SELECT id,name,address,phone,link,point,deleteFlag,createUser,createAT,updateUser,updateAT FROM NetworkInfo WHERE deleteFlag=1 #if(:1!=''){AND name like '%##(:1)%' } ORDER BY updateAT DESC LIMIT :2,:3 ")
    List<Map> queryNetworkInfoByName(String name,int start,int length);
	
	//发行网点Size
	@SQL("SELECT count(1) FROM NetworkInfo WHERE deleteFlag=1 #if(:1!=''){AND name like '%##(:1)%' } ORDER BY updateAT DESC ")
    int queryNetworkInfoByNameCount(String name);
	
	//报亭信息
	@SQL("SELECT id,name,address,phone,link,point,deleteFlag,createUser,createAT,updateUser,updateAT FROM NewsstandInfo WHERE deleteFlag=1 #if(:1!=''){AND name like '%##(:1)%' } ORDER BY updateAT DESC LIMIT :2,:3 ")
    List<Map> queryNewsstandInfoByName(String name,int start,int length);
	
	//报亭信息Size
	@SQL("SELECT count(1) FROM NewsstandInfo WHERE deleteFlag=1 #if(:1!=''){AND name like '%##(:1)%' } ORDER BY updateAT DESC ")
    int queryNewsstandInfoByNameCount(String name);
	
	//呼叫中心信息
	@SQL("SELECT id,name,phone,link,deleteFlag,createUser,createAT,updateUser,updateAT FROM CallCenterInfo WHERE deleteFlag=1 #if(:1!=''){AND name like '%##(:1)%' } #if(:2!=''){AND phone like '%##(:2)%' } ORDER BY updateAT DESC LIMIT :3,:4 ")
    List<Map> queryCallCenterInfoByName(String name,String phone,int start,int length);
	
	//呼叫中心信息Size
	@SQL("SELECT count(1) FROM CallCenterInfo WHERE deleteFlag=1 #if(:1!=''){AND name like '%##(:1)%' } #if(:2!=''){AND phone like '%##(:2)%' } ORDER BY updateAT DESC ")
    int queryCallCenterInfoByNameCount(String name,String phone);
	
	//插入爆料
	@SQL("INSERT INTO TipInfo (id,toAddress,title,descs,imgUrl,link,phone,address,deleteFlag,createUser,createAT,updateUser,updateAT) VALUES (:1,:2,:3,:4,:5,:6,:7,:8,1,:6,now(),:6,now())")
	void saveTipInfo(String id,String toAddress,String title,String descs,
			String imgUrl,String link,String phone,String address);
	
	//下载中心
	@SQL("select id,title,type,content,orderNo,upFile,carouselImage from NewRanking where deleteFlag = 1 and type=:1 order by orderNo asc limit :2,:3")
	List<Map> queryDownloadByType(String type, int start, int length);
	
	// 下载中心
	@SQL("select count(1) from NewRanking where deleteFlag = 1 and type=:1")
	int downloadSizeByType(String type);
	
}
